package com.galeno.combiner;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/**
 * Author:   galeno
 * Date:     21/07/27
 * Description:
 */
public class MyCombiner extends Reducer<Text, IntWritable , Text , IntWritable> {
    @Override
    protected void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
        int cnt = 0 ;
        for (IntWritable value : values) {
            cnt ++ ;
        }
        context.write(key , new IntWritable(cnt));
    }
}
